<script setup lang="ts">
import type {achievementType} from "@/types/achievement.ts";
import {nextTick, reactive, ref} from "vue";
import ExpertReviewDetail from "@/pages/expertReview/expertReviewDetail.vue";

const props = withDefaults(
    defineProps<{
      link?: string
    }>(),
    {
      link: 'intranet'
    }
)

const option = reactive({
  visible: false,
  registUid: '',
  type: ''
})

const reviewForm = ref<{
  show: () => void;
}>();

const handleCancel = () => {
  option.visible = false
}

const init = (data: achievementType) => {
  option.visible = true
  console.log(data)
  option.type = data.projectType
  option.registUid = data.registUid
  nextTick(() => {
    reviewForm.value?.show()
  })
}

defineExpose({
  init
})
</script>

<template>
  <a-modal
      width="80%"
      :closable="true"
      @cancel="handleCancel"
      :visible="option.visible"
      ref="drawer"
      title="项目详细"
      :footer="false"
  >
    <div class="body">
      <ExpertReviewDetail
          :link="link"
          ref="reviewForm"
          :registUid="option.registUid"
          :type="option.type"
      />
    </div>
  </a-modal>
</template>

<style scoped lang="scss">
.body {
  min-height: 800px;
  //height: 600px;
  //overflow: hidden;
}
</style>